#region using

using System;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

#endregion

namespace RealEstate.Web
{
	[Serializable]
	public class Command : ICloneable, ISerializable
	{
		#region Constructors

		public Command(string strDomainName, string strCommandName, NameValueCollection queryParameters)
		{
			this.DomainName = strDomainName;
			this.CommandName = strCommandName;
			this.QueryParameters = queryParameters;
		}

		#endregion

		#region ICloneable Members

		public object Clone()
		{
			throw new Exception("The method or operation is not implemented.");
		}

		#endregion

		#region ISerializable Members

		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("DomainName", this.DomainName);
			info.AddValue("CommandName", this.CommandName);
			info.AddValue("RequestParameters", this.QueryParameters);
		}

		#endregion

		#region Private Fields

		private string domainName;

		private string commandName;

		private NameValueCollection requestParameters;

		#endregion

		#region Public Properties

		public string DomainName
		{
			get { return domainName; }
			set { domainName = value; }
		}

		public string CommandName
		{
			get { return commandName; }
			set { commandName = value; }
		}

		public NameValueCollection QueryParameters
		{
			get { return requestParameters; }
			set { requestParameters = value; }
		}

		#endregion

		#region Public Methods

		public void Do()
		{
			Dispatcher.Instance.Do(this);
		}

		#endregion
	}
}
